<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
		<script type="text/javascript" src="lib/html5.js"></script>
		<script type="text/javascript" src="lib/respond.min.js"></script>
		<script type="text/javascript" src="lib/PIE_IE678.js"></script>
		<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
				<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
				<script>DD_belatedPNG.fix('*');</script>
				<![endif]-->
<title>新增标签</title>
</head>
<body>
	<div class="pd-20">
		<form action="<%=path%>/backstage/label-add" method="post"
			class="form form-horizontal" id="form-u_label-add">
			<input type="hidden" id="id" name="id" value='${u_label.id}' />
			<div class="row cl">
				<label class="form-label col-2">所属模块：</label>
				<div class="formControls col-2">
					<select name="type" class="select" id="type">
						<option value="-1">请选择模块</option>
						<option <c:if test="${u_label.type==0}">selected="selected"</c:if> value="0">文章标签</option>
						<option <c:if test="${u_label.type==1}">selected="selected"</c:if> value="1">兴趣标签</option>
						<option <c:if test="${u_label.type==2}">selected="selected"</c:if> value="2">订阅标签</option>
						<option <c:if test="${u_label.type==3}">selected="selected"</c:if> value="3">行业职位标签</option>
						<!-- <option <c:if test="${u_label.type==4}">selected="selected"</c:if> value="4">圈子标签</option> -->
						<option <c:if test="${u_label.type==5}">selected="selected"</c:if> value="5">行业类别标签</option>
						<!-- <option <c:if test="${u_label.type==6}">selected="selected"</c:if> value="6">自媒体属性</option> -->
						<option <c:if test="${u_label.type==7}">selected="selected"</c:if> value="7">自媒体领域</option>
						<option <c:if test="${u_label.type==8}">selected="selected"</c:if> value="8">专业领域</option>
					</select>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">父标签1：</label>
				<div class="formControls col-2">
					<select name="parent_id" id="parent_id" class="select" data="${u_label.parent_id}">
						<option value="-1">默认</option>
					</select>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>名称：</label>
				<div class="formControls col-3">
					<input type="text" class="input-text" value="${u_label.label_name}"
						placeholder="" id="" name="label_name" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>排序：</label>
				<div class="formControls col-1">
					<input type="text" class="input-text" value="${u_label.sort}"
						placeholder="" id="" name="sort" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<div class="col-10 col-offset-2">
					<button onClick="u_label_save_submit();"
						class="btn btn-primary radius" type="submit">保存并提交</button>
					<button onClick="layer_close();" class="btn btn-default radius"
						type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>
			</div>
		</form>
	</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
	<script type="text/javascript"
		src="lib/Validform/5.3.2/Validform.min.js"></script>
	<script type="text/javascript"
		src="lib/webuploader/0.1.5/webuploader.min.js"></script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/ueditor.config.js"></script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
			$(document).ready(function(){
				$('#type').change(function(){
					var p1=$(this).children('option:selected').val();//这就是selected的值
					loadparentid(p1,0);
				})
				var value=$('#type').children('option:selected').val();//这就是selected的值
				loadparentid(value,$("#parent_id").attr("data"));
			})
				
			function u_label_save_submit(){
				$("#form-u_label-add").Validform({
					tiptype:2,
					ajaxPost:true,
					callback:function(form){
						var index = parent.layer.getFrameIndex(window.name);
						if (index){//关闭弹出层
							parent.$('.btn-refresh').click();
							parent.layer.close(index);
						}else{//单独的页面
							location.href = "<%=path%>/backstage/u_label-list";
						}
					}
				});
			}
			 function loadparentid(value,selectid){
			 		var html = "<option value='-1'>默认</option>";
			 		if(value == -1){
			 			$("#parent_id").html(html);
			 		}else{
			 			$.ajax({
							type:"post",
							url:"<%=path%>/backstage/getparentlabels",
							data:"type="+value,
							success:function(msg){
		 						if(msg.error == "0000"){
		 							
	 								for (var i = 0; i <msg.datas.length; i++) {
										html = html + "<option ";
										if(msg.datas[i].id==selectid){
											html = html + "selected='selected'";
										}
										html = html +" value='"+msg.datas[i].id+"'>"+msg.datas[i].label_name+"</option>";
	 								};
	 								$("#parent_id").html(html);
								}
		 					},
		 					error: function(XMLHttpRequest, textStatus, errorThrown) {
		 						layer.msg('网络失败，请刷新页面后重试');
		 						$("#parent_id").html(html);
		 					}
						})
		 			}		 			
		 	}
	</script>
</body>
</html>